import _thread
import time
import urllib.request
import json


def print_time(postData,delay):
    url = "http://www.babei.com/api/v1/pay/babei"
    # count = 0
    # while count < 100:
    #     count += 1
    data = urllib.parse.urlencode(postData).encode(encoding='UTF8')
    response = urllib.request.urlopen(url, data)
    print(delay)
    print (response.read())


try:
    # _thread.start_new_thread(print_time,({"order_money":"153.00","order_no":"SH20190701164622484004","pay_type":2},0))
    # _thread.start_new_thread(print_time, ({"order_money": "153.00", "order_no": "SH20190701164622484004","pay_type":2}, 0))
    # _thread.start_new_thread(print_time, ({"order_money": "153.00", "order_no": "SH20190701164622484004","pay_type":2}, 0))
    #_thread.start_new_thread(print_time, ({"order_money": "173.20", "order_no": "SH20190701170531707304","pay_type":2}, 1))
    _thread.start_new_thread(print_time, ({"order_money": "8.00", "order_no": "SH20190701170542736981","pay_type":2}, 2))
    #_thread.start_new_thread(print_time, ({"order_money": "120.10", "order_no": "SH20190701170751913271","pay_type":2}, 3))
    _thread.start_new_thread(print_time, ({"order_money": "0.00", "order_no": "SH20190701170820265207","pay_type":2}, 4))
    # _thread.start_new_thread(print_time,
    #                          ({"order_money": "173.20", "order_no": "SH20190701170531707304", "pay_type": 2}, 1))
    # _thread.start_new_thread(print_time,
    #                          ({"order_money": "8.00", "order_no": "SH20190701170542736981", "pay_type": 2}, 2))
    # _thread.start_new_thread(print_time,
    #                          ({"order_money": "120.10", "order_no": "SH20190701170751913271", "pay_type": 2}, 0))
    # _thread.start_new_thread(print_time,
    #                          ({"order_money": "0.00", "order_no": "SH20190701170820265207", "pay_type": 2}, 0))
    # _thread.start_new_thread(print_time,
    #                          ({"order_money": "173.20", "order_no": "SH20190701170531707304", "pay_type": 2}, 0))
    # _thread.start_new_thread(print_time,
    #                          ({"order_money": "8.00", "order_no": "SH20190701170542736981", "pay_type": 2}, 0))
    # _thread.start_new_thread(print_time,
    #                          ({"order_money": "120.10", "order_no": "SH20190701170751913271", "pay_type": 2}, 0))
    # _thread.start_new_thread(print_time,
    #                          ({"order_money": "0.00", "order_no": "SH20190701170820265207", "pay_type": 2}, 0))
    # _thread.start_new_thread(print_time, ({"order_money": "153.00", "order_no": "SH20190701164622484004","pay_type":2}, 0))
    # _thread.start_new_thread(print_time, ({"order_money": "74.10", "order_no": "SH20190701164640248270","pay_type":2}, 0))
    # _thread.start_new_thread(print_time, ({"order_money": "153.00", "order_no": "SH20190701164622484004","pay_type":2}, 0))
    # _thread.start_new_thread(print_time, ({"order_money": "74.10", "order_no": "SH20190701164640248270","pay_type":2}, 0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
    # _thread.start_new_thread(print_time, (
    # {"order_money": "437", "reward_id": "0", "is_machine": 0, "address": 1, "order_type": "1", "pay_type": "0"}, 0))
except:
    print("Error: 无法启动线程")

while 1:
    pass